home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
NOVA - For the NeXT Workstation
/
NOVA - For the NeXT Workstation.iso
/
Documents
/
NeXTAnswers
/
hardware.422
< prev
next >
Wrap
Text File
|
1992-02-06
|
812b
|
38 lines
Q: How can a program determine which CPU board revision is in the computer being used?
A: Use the table() system call (not documented). Sample code:
#include <sys/table.h> /* Not really necessary, but nice for completeness */
#include <machine/table.h>
#include <machine/cpu.h>
#include <stdio.h>
extern int table(int id, int index, caddr_t address, int n_elements, int element_size);
main(argc, argv)
int argc;
char *argv[];
{
int res;
unsigned cpu_rev;
int error;
res = table(TBL_NeXT_CPU_REV, 0, (char *)&cpu_rev, 1, sizeof(cpu_rev));
if (res == -1) {
perror(argv[0]);
(void)fprintf(stderr, "%s: unable to get table value.\n", argv[0]);
exit(1);
} else {
(void)printf("%s: table returned; res=%d, cpu_rev=%d.\n",
argv[0], res, cpu_rev);
}
}
QA422
Valid for 1.0
Valid for 2.0